<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!doctype html>
<html lang="zh-CN">
<head>
<title>批量发送短信</title>
</head>
<body>
	<h2>发送进度</h2>
	<div style="font-size: 30px;">
		<span id="finishCountSpan"></span>/ <span id="totalCountSpan"></span>
		---> <span id="percentDiv"></span>
	</div>
	<button id="btnClearLock">Clear Lock</button>
	<script src="../static/jquery-1.11.0.js"></script>
	<script type="text/javascript">
		$(function() {

			window.setInterval(function() {
				$.post("batch_send_mobile_message_progress.htm", {
					t : new Date()
				}, function(data) {
					if (data.total_count) {
						$("#totalCountSpan").html(data.total_count);
					}
					if (data.finish_count) {
						$("#finishCountSpan").html(data.finish_count);

					}
					$("#percentDiv").html(
							parseInt(
									($("#finishCountSpan").html())
											/ parseInt($("#totalCountSpan")
													.html()) * 100).toFixed(0)
									+ "%");
				}, 'json');

			}, 1000);

			$("#btnClearLock").click(function() {
				if (!confirm("确认清除？")) {
					return;
				}
				$.post("batch_send_mobile_message_lock_clear.htm", {
					t : new Date()
				}, function() {

					alert("清除成功");
				}, "json");
			});

		});
	</script>
</body>
</html>
